using HCore.Core;
using HCore.Unity.Behaviour;
using HCore.Unity.Core;
using JetBrains.Annotations;
using UnityEngine;

namespace UI.UIGame.Menu
{
    public class SwitchBackground : SmartMonoBehaviour
    {
        private FunctionUpdater mFunctionUpdater;

        private void Start()
        {
            Get().AddButtonClickListener(() => HCore.HCore.Instance.PublishEvent(SwitchBackgroundCommand.Instance));
            mFunctionUpdater = GameUtils.CreateKeyCodeAction(KeyCode.R, () => HCore.HCore.Instance.PublishEvent(SwitchBackgroundCommand.Instance));
        }

        protected void OnDestroy()
        {
            mFunctionUpdater?.DestroySelf();
        }
    }

    /// <summary>
    ///     切换背景图片
    /// </summary>
    [UsedImplicitly]
    public class SwitchBackgroundCommand : Singleton<SwitchBackgroundCommand>
    {
    }
}